Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

struct System.​ArraySegment`1

Assembly: System.Runtime

Delimits a section of a one-dimensional array.

Properties

public T[]
Array
Gets the original array containing the range of elements that the array segment delimits.
public int
Count
Gets the number of elements in the range delimited by the array segment.
public T
Item
public int
Offset
Gets the position of the first element in the range delimited by the array segment, relative to the start of the original array.

Methods

public void
CopyTo​(ArraySegment`1 destination)
public void
CopyTo​(T[] destination)
public void
CopyTo​(T[] destination, int destinationIndex)
public bool
Equals​(ArraySegment`1 obj)
public bool
Equals​(object obj)
obj The object to be compared with the current instance.
Returns <see langword="true" /> if the specified object is a <see cref="T:System.ArraySegment`1" /> structure and is equal to the current instance; otherwise, <see langword="false" /> .
Determines whether the specified object is equal to the current instance.
public Enumerator
GetEnumerator​()
Returns An enumerator that can be used to iterate through the array segment.
Returns an enumerator that can be used to iterate through the array segment.
public int
GetHashCode​()
Returns A 32-bit signed integer hash code.
Returns the hash code for the current instance.
Slice​(int index)
index The index at which to begin the slice.
Returns An array segment that consists of all elements of the current array segment from <paramref name="index" /> to the end of the array segment.
Forms a slice out of the current array segment starting at the specified index.
Slice​(int index, int count)
index The index at which to begin the slice.
count The desired length of the slice.
Returns An array segment of <paramref name="count" /> elements starting at <paramref name="index" /> .
Forms a slice of the specified length out of the current array segment starting at the specified index.
public T[]
ToArray​()
Returns An array containing the data in the current array segment.
Copies the contents of this array segment into a new array.
public string
ToString​()
Inherited from ValueType
Returns The fully qualified type name.
Returns the fully qualified type name of this instance.
protected void
Finalize​()
Inherited from object
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
public Type
GetType​()
Inherited from object
Returns The exact runtime type of the current instance.
Gets the <see cref="T:System.Type" /> of the current instance.
protected object
MemberwiseClone​()
Inherited from object
Returns A shallow copy of the current <see cref="T:System.Object" /> .
Creates a shallow copy of the current <see cref="T:System.Object" /> .